/**
 * 
 */
package com.coral.fundation.encrypt.impl;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import com.coral.fundation.encrypt.IEncrypt;

/**
 * @author Coral
 *
 */
public class MD5Encrypt implements IEncrypt {

	public String encrypt(String value) {
		String encryptStr = null;
		try {
	        MessageDigest md5 = MessageDigest.getInstance("MD5");
	        byte[] obj = value.getBytes();
	        md5.update(obj);
	        byte messageDigest[] = md5.digest();
	        BigInteger number = new BigInteger(1, messageDigest);
	        encryptStr =number.toString(16).toString();
	    } catch (NoSuchAlgorithmException e) {
	        e.printStackTrace();
	    }
		return encryptStr;
	}

	public String decrypt() {
		return null;
	}
}
